<?php
/**
* Class and Function List:
* Function list:
* - add()
* - display()
* - count()
* - isNoError()
*/
/****************************************************************
* Filename: class.errormessages.php5
* Created: Feb 9, 2007
*
* SHORT_DESC
*
* LONG_DESC
*
* author     Duy Nguyen <duy@dirox.net>
* version
* see
*
****************************************************************/
class ErrorMessages
{
    var $errors = array();
    function add($message)
    {
        $this->errors[] = $message;
    }
    function display()
    {        
        $str = '<b></b>';
        foreach($this->errors as $e)        	
        	$str = $this->addErrorImage($str) . $e . '<br />';        

        $str = substr($str, 0, strlen($str) - strlen('<br />'));
        return stripslashes(trim($str));
    }
    function count()
    {
        return count($this->errors);
    }
    function addErrorImage($str)
    {
        return $str .= "&nbsp;" .
        			"<img src=" . APPLICATION_URL ."/images/info2_small.png alt=\"\" /> ";
    }
    function isNoError()
    {
        return $this->count() == 0;
    }
}
?>